<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="favicon.ico">
    <title>gateway - lamb</title>
    <link type="text/css" rel="stylesheet" href="/css/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link type="text/css" rel="stylesheet" href="/css/all.css">
    <link type="text/css" rel="stylesheet" href="/css/flat/blue.css">
    <link type="text/css" rel="stylesheet" href="/css/gateway.css">
  </head>
  <body>
    <div class="navbar navbar-default">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand">
            <img alt="Brand" src="/img/logo.png" width="32" height="32" style="margin-top:-6px" />
          </a>
          <a class="navbar-brand">lamb</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            <li><a href="/status/inbound">状态监控</a></li>
            <li><a href="/company">企业管理</a></li>
            <li><a href="/account">帐号管理</a></li>
            <li><a href="/template">签名模板</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">路由管理</a>
              <ul class="dropdown-menu">
                <li><a href="/routing">上行路由</a></li>
                <li><a href="/delivery">下行路由</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">通道管理</a>
              <ul class="dropdown-menu">
                <li><a href="/gateway">落地通道</a></li>
                <li><a href="/gateway/report">通道数据统计</a></li>
                <li><a href="/gateway/check">通道测试</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">数据记录</a>
              <ul class="dropdown-menu">
                <li><a href="/message">上行短信</a></li>
                <li><a href="/message/deliver">下行短信</a></li>
                <li><a href="/message/statistic">数据统计</a></li>
              </ul>
            </li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">系统管理</a>
              <ul class="dropdown-menu">
                <li><a href="/keyword">关键词库</a></li>
                <li><a href="/payment/logs">充值记录</a></li>
                <li><a href="/service/core">服务状态</a></li>
              </ul>
            </li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="/logout"><span class="glyphicon glyphicon-log-out"></span> 退 出</a></li>
          </ul>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <ol class="breadcrumb">
          <li><a href="#">Home</a></li>
          <li class="active">Gateway</li>
          <li class="pull-right add"><button type="button" class="btn btn-success btn-xs" onclick="show()"><span class="glyphicon glyphicon-plus"></span> 创 建</button></li>
        </ol>
      </div>
      <div class="row contents">
        <table class="table table-hover">
          <thead>
            <tr><th>#</th><th>通道名称</th><th>通道类型</th><th>IP 地址</th><th>最大并发</th><th>备注信息</th><th>编 辑</th><th>删 除</th></tr>
          </thead>
          <tbody>
          </tbody>
        </table>
      </div>
    </div>
</div>
<script id="contents" type="text/template">
  {{#each data}}
  <tr>
    <td><span class="glyphicon glyphicon-globe"></span></td>
    <td>{{name}}</td>
    <td>cmpp/2.0</td>
    <td>{{host}}</td>
    <td>{{concurrent}}/s</td>
    <td>{{description}}</td>
    <td><button type="button" class="btn btn-default btn-xs" onclick="deleteGateway({{id}})"><span class="glyphicon glyphicon-trash"></span> 删 除</button></td>
    <td><button type="button" class="btn btn-default btn-xs" onclick="changeGateway({{id}})"><span class="glyphicon glyphicon-edit"></span> 编 辑</button></td>
  </tr>
  {{/each}}
</script>
<script id="check-page" type="text/template">
  <div class="container" style="width: 580px; height: 300px; padding: 20px">
    <div class="alert alert-info"><strong>Warning!</strong> 对通道进行测试时，请确保短信内容符合相关法律规定</div>
    <form id="form" class="form-horizontal">
      <div class="form-group">
        <div class="col-xs-12 col-sm-12">
          <input type="text" class="form-control" name="phone" placeholder="请输入手机号码" required="required">
        </div>
      </div>
      <div class="form-group">
        <div class="col-xs-12 col-sm-12">
          <textarea class="form-control" rows="5" cols="15" name="message" placeholder="请输入短信内容" required="required"></textarea>
        </div>
      </div>
      <div class="form-group">
        <div class="col-xs-12 col-sm-12 text-center">
          <button type="button" class="btn btn-success" onclick="formCheck({{id}})">发 送</button>
          <button type="button" class="btn btn-default" onclick="layer.closeAll()">取 消</button>
        </div>
      </div>
    </form>
  </div>
</script>
<script id="new-page" type="text/template">
  <form id="new-form" class="form-horizontal">
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">通道名称:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="name" placeholder="Enter Name" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道名称</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">网关地址:</label>
      <div class="col-xs-3 col-sm-3" style="width:21%">
        <input type="text" class="form-control" name="host" placeholder="IP Address" required="required">
      </div>
      <div class="col-xs-1 col-sm-1" style="width:12%;padding-left:0px">
        <input type="number" class="form-control" name="port" min="1" max="65535" placeholder="Port" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道网关 IP 地址</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">Account:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="username" placeholder="Enter Username" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道账号</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">Password:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="password" placeholder="Enter Password" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道密码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">SPID:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="spid" placeholder="Enter SPID" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道 SPID 号码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">接入号码:</label>
      <div class="col-xs-2 col-sm-2" style="width:21%">
        <input type="text" class="form-control" name="spcode" placeholder="Enter SpCode" required="required">
      </div>
      <div class="checkbox col-xs-2 col-sm-2" style="width:12%;padding-left:0px">
        <label style="padding-left:0px">
          <input id="extended" type="checkbox" name="extended" value="1" /> 允许扩展
        </label>
      </div>
      <div class="col-xs-3 col-sm-3">
        <span class="help-block">落地通道接入号码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">短信编码:</label>
      <div class="col-xs-4 col-sm-4">
        <select class="form-control" name="encoding">
          <option value="0">ASCII</option>
          <option value="8">UCS-2</option>
          <option value="11">UTF-8</option>
          <option value="15">GBK</option>
        </select>
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道短信编码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">最大并发:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="number" class="form-control" name="concurrent" min="1" placeholder="Enter Concurrent Number" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道最大并发数</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">备注信息:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="description" placeholder="Enter Description" />
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道相关备注说明</span>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-4 col-xs-8 col-sm-8">
        <button type="button" class="btn btn-success" onclick="formSubmit()">创 建</button>
        <button type="button" class="btn btn-default" onclick="layer.closeAll()">取 消</button>
      </div>
    </div>
  </form>
</script>
<script id="edit-page" type="text/template">
  <form id="edit-form" class="form-horizontal">
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">通道名称:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="name" value="{{name}}" placeholder="Enter Name" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道名称</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">网关地址:</label>
      <div class="col-xs-3 col-sm-3" style="width:21%">
        <input type="text" class="form-control" name="host" value="{{host}}" placeholder="IP Address" required="required">
      </div>
      <div class="col-xs-1 col-sm-1" style="width:12%;padding-left:0px">
        <input type="number" class="form-control" name="port" value="{{port}}" min="1" max="65535" placeholder="Port" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道网关 IP 地址</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">Account:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="username" value="{{username}}" placeholder="Enter Username" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道账号</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">Password:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="password" value="{{password}}" placeholder="Enter Password" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道密码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">SPID:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="spid" value="{{spid}}" placeholder="Enter SPID" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道 SPID 号码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">接入号码:</label>
      <div class="col-xs-2 col-sm-2" style="width:21%">
        <input type="text" class="form-control" name="spcode" value="{{spcode}}" placeholder="Enter SpCode" required="required">
      </div>
      <div class="checkbox col-xs-2 col-sm-2" style="width:12%;padding-left:0px">
        <label style="padding-left:0px">
          <input id="extended" type="checkbox" name="extended" value="1" {{checkchecked extended}}/> 允许扩展
        </label>
      </div>
      <div class="col-xs-3 col-sm-3">
        <span class="help-block">落地通道接入号码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">短信编码:</label>
      <div class="col-xs-4 col-sm-4">
        <select class="form-control" name="encoding">
          <option value="0"{{checkselectd encoding 0}}>ASCII</option>
          <option value="8"{{checkselectd encoding 8}}>UCS-2</option>
          <option value="11"{{checkselectd encoding 11}}>UTF-8</option>
          <option value="15"{{checkselectd encoding 15}}>GBK</option>
        </select>
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道短信编码</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">最大并发:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="number" class="form-control" name="concurrent" value="{{concurrent}}" min="1" placeholder="Enter Concurrent Number" required="required">
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道最大并发数</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-4 col-sm-4 control-label">备注信息:</label>
      <div class="col-xs-4 col-sm-4">
        <input type="text" class="form-control" name="description" value="{{description}}" placeholder="Enter Description" />
      </div>
      <div class="col-xs-4 col-sm-4">
        <span class="help-block">落地通道相关备注说明</span>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-4 col-xs-8 col-sm-8">
        <button type="button" class="btn btn-success" onclick="formChange({{id}})">保 存</button>
        <button type="button" class="btn btn-default" onclick="layer.closeAll()">取 消</button>
      </div>
    </div>
  </form>
</script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/handlebars.min.js"></script>
<script type="text/javascript" src="/js/icheck.min.js"></script>
<script type="text/javascript" src="/js/layer.js"></script>
<script type="text/javascript" src="/js/gateway.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $('li.dropdown').mouseover(function() {   
      $(this).addClass('open');
    }).mouseout(function() {
      $(this).removeClass('open');
    });
    startup();
  });
</script>
</body>
</html>
